Left Termination of the query pattern gcd_in_3(g, g, a) w.r.t. the given Prolog program could successfully be proven:



Prolog
  ↳ PrologToPiTRSProof

Clauses:

gcd(X, Y, D) :- ','(le(X, Y), gcd_le(X, Y, D)).
gcd(X, Y, D) :- ','(gt(X, Y), gcd_le(Y, X, D)).
gcd_le(0, Y, Y).
gcd_le(s(X), Y, D) :- ','(add(s(X), Z, Y), gcd(s(X), Z, D)).
gt(s(X), s(Y)) :- gt(X, Y).
gt(s(X), 0).
le(s(X), s(Y)) :- le(X, Y).
le(0, s(Y)).
le(0, 0).
add(s(X), Y, s(Z)) :- add(X, Y, Z).
add(0, X, X).

Queries:

gcd(g,g,a).

We use the technique of [30].Transforming Prolog into the following Term Rewriting System:
Pi-finite rewrite system:
The TRS R consists of the following rules:

gcd_in(X, Y, D) → U3(X, Y, D, gt_in(X, Y))
gt_in(s(X), 0) → gt_out(s(X), 0)
gt_in(s(X), s(Y)) → U7(X, Y, gt_in(X, Y))
U7(X, Y, gt_out(X, Y)) → gt_out(s(X), s(Y))
U3(X, Y, D, gt_out(X, Y)) → U4(X, Y, D, gcd_le_in(Y, X, D))
gcd_le_in(s(X), Y, D) → U5(X, Y, D, add_in(s(X), Z, Y))
add_in(0, X, X) → add_out(0, X, X)
add_in(s(X), Y, s(Z)) → U9(X, Y, Z, add_in(X, Y, Z))
U9(X, Y, Z, add_out(X, Y, Z)) → add_out(s(X), Y, s(Z))
U5(X, Y, D, add_out(s(X), Z, Y)) → U6(X, Y, D, gcd_in(s(X), Z, D))
gcd_in(X, Y, D) → U1(X, Y, D, le_in(X, Y))
le_in(0, 0) → le_out(0, 0)
le_in(0, s(Y)) → le_out(0, s(Y))
le_in(s(X), s(Y)) → U8(X, Y, le_in(X, Y))
U8(X, Y, le_out(X, Y)) → le_out(s(X), s(Y))
U1(X, Y, D, le_out(X, Y)) → U2(X, Y, D, gcd_le_in(X, Y, D))
gcd_le_in(0, Y, Y) → gcd_le_out(0, Y, Y)
U2(X, Y, D, gcd_le_out(X, Y, D)) → gcd_out(X, Y, D)
U6(X, Y, D, gcd_out(s(X), Z, D)) → gcd_le_out(s(X), Y, D)
U4(X, Y, D, gcd_le_out(Y, X, D)) → gcd_out(X, Y, D)

The argument filtering Pi contains the following mapping:
gcd_in(x1, x2, x3)  =  gcd_in(x1, x2)
U3(x1, x2, x3, x4)  =  U3(x1, x2, x4)
gt_in(x1, x2)  =  gt_in(x1, x2)
s(x1)  =  s(x1)
0  =  0
gt_out(x1, x2)  =  gt_out
U7(x1, x2, x3)  =  U7(x3)
U4(x1, x2, x3, x4)  =  U4(x4)
gcd_le_in(x1, x2, x3)  =  gcd_le_in(x1, x2)
U5(x1, x2, x3, x4)  =  U5(x1, x4)
add_in(x1, x2, x3)  =  add_in(x1, x3)
add_out(x1, x2, x3)  =  add_out(x2)
U9(x1, x2, x3, x4)  =  U9(x4)
U6(x1, x2, x3, x4)  =  U6(x4)
U1(x1, x2, x3, x4)  =  U1(x1, x2, x4)
le_in(x1, x2)  =  le_in(x1, x2)
le_out(x1, x2)  =  le_out
U8(x1, x2, x3)  =  U8(x3)
U2(x1, x2, x3, x4)  =  U2(x4)
gcd_le_out(x1, x2, x3)  =  gcd_le_out(x3)
gcd_out(x1, x2, x3)  =  gcd_out(x3)

Infinitary Constructor Rewriting Termination of PiTRS implies Termination of Prolog



↳ Prolog
  ↳ PrologToPiTRSProof
PiTRS
      ↳ DependencyPairsProof

Pi-finite rewrite system:
The TRS R consists of the following rules:

gcd_in(X, Y, D) → U3(X, Y, D, gt_in(X, Y))
gt_in(s(X), 0) → gt_out(s(X), 0)
gt_in(s(X), s(Y)) → U7(X, Y, gt_in(X, Y))
U7(X, Y, gt_out(X, Y)) → gt_out(s(X), s(Y))
U3(X, Y, D, gt_out(X, Y)) → U4(X, Y, D, gcd_le_in(Y, X, D))
gcd_le_in(s(X), Y, D) → U5(X, Y, D, add_in(s(X), Z, Y))
add_in(0, X, X) → add_out(0, X, X)
add_in(s(X), Y, s(Z)) → U9(X, Y, Z, add_in(X, Y, Z))
U9(X, Y, Z, add_out(X, Y, Z)) → add_out(s(X), Y, s(Z))
U5(X, Y, D, add_out(s(X), Z, Y)) → U6(X, Y, D, gcd_in(s(X), Z, D))
gcd_in(X, Y, D) → U1(X, Y, D, le_in(X, Y))
le_in(0, 0) → le_out(0, 0)
le_in(0, s(Y)) → le_out(0, s(Y))
le_in(s(X), s(Y)) → U8(X, Y, le_in(X, Y))
U8(X, Y, le_out(X, Y)) → le_out(s(X), s(Y))
U1(X, Y, D, le_out(X, Y)) → U2(X, Y, D, gcd_le_in(X, Y, D))
gcd_le_in(0, Y, Y) → gcd_le_out(0, Y, Y)
U2(X, Y, D, gcd_le_out(X, Y, D)) → gcd_out(X, Y, D)
U6(X, Y, D, gcd_out(s(X), Z, D)) → gcd_le_out(s(X), Y, D)
U4(X, Y, D, gcd_le_out(Y, X, D)) → gcd_out(X, Y, D)

The argument filtering Pi contains the following mapping:
gcd_in(x1, x2, x3)  =  gcd_in(x1, x2)
U3(x1, x2, x3, x4)  =  U3(x1, x2, x4)
gt_in(x1, x2)  =  gt_in(x1, x2)
s(x1)  =  s(x1)
0  =  0
gt_out(x1, x2)  =  gt_out
U7(x1, x2, x3)  =  U7(x3)
U4(x1, x2, x3, x4)  =  U4(x4)
gcd_le_in(x1, x2, x3)  =  gcd_le_in(x1, x2)
U5(x1, x2, x3, x4)  =  U5(x1, x4)
add_in(x1, x2, x3)  =  add_in(x1, x3)
add_out(x1, x2, x3)  =  add_out(x2)
U9(x1, x2, x3, x4)  =  U9(x4)
U6(x1, x2, x3, x4)  =  U6(x4)
U1(x1, x2, x3, x4)  =  U1(x1, x2, x4)
le_in(x1, x2)  =  le_in(x1, x2)
le_out(x1, x2)  =  le_out
U8(x1, x2, x3)  =  U8(x3)
U2(x1, x2, x3, x4)  =  U2(x4)
gcd_le_out(x1, x2, x3)  =  gcd_le_out(x3)
gcd_out(x1, x2, x3)  =  gcd_out(x3)


Using Dependency Pairs [1,30] we result in the following initial DP problem:
Pi DP problem:
The TRS P consists of the following rules:

GCD_IN(X, Y, D) → U31(X, Y, D, gt_in(X, Y))
GCD_IN(X, Y, D) → GT_IN(X, Y)
GT_IN(s(X), s(Y)) → U71(X, Y, gt_in(X, Y))
GT_IN(s(X), s(Y)) → GT_IN(X, Y)
U31(X, Y, D, gt_out(X, Y)) → U41(X, Y, D, gcd_le_in(Y, X, D))
U31(X, Y, D, gt_out(X, Y)) → GCD_LE_IN(Y, X, D)
GCD_LE_IN(s(X), Y, D) → U51(X, Y, D, add_in(s(X), Z, Y))
GCD_LE_IN(s(X), Y, D) → ADD_IN(s(X), Z, Y)
ADD_IN(s(X), Y, s(Z)) → U91(X, Y, Z, add_in(X, Y, Z))
ADD_IN(s(X), Y, s(Z)) → ADD_IN(X, Y, Z)
U51(X, Y, D, add_out(s(X), Z, Y)) → U61(X, Y, D, gcd_in(s(X), Z, D))
U51(X, Y, D, add_out(s(X), Z, Y)) → GCD_IN(s(X), Z, D)
GCD_IN(X, Y, D) → U11(X, Y, D, le_in(X, Y))
GCD_IN(X, Y, D) → LE_IN(X, Y)
LE_IN(s(X), s(Y)) → U81(X, Y, le_in(X, Y))
LE_IN(s(X), s(Y)) → LE_IN(X, Y)
U11(X, Y, D, le_out(X, Y)) → U21(X, Y, D, gcd_le_in(X, Y, D))
U11(X, Y, D, le_out(X, Y)) → GCD_LE_IN(X, Y, D)

The TRS R consists of the following rules:

gcd_in(X, Y, D) → U3(X, Y, D, gt_in(X, Y))
gt_in(s(X), 0) → gt_out(s(X), 0)
gt_in(s(X), s(Y)) → U7(X, Y, gt_in(X, Y))
U7(X, Y, gt_out(X, Y)) → gt_out(s(X), s(Y))
U3(X, Y, D, gt_out(X, Y)) → U4(X, Y, D, gcd_le_in(Y, X, D))
gcd_le_in(s(X), Y, D) → U5(X, Y, D, add_in(s(X), Z, Y))
add_in(0, X, X) → add_out(0, X, X)
add_in(s(X), Y, s(Z)) → U9(X, Y, Z, add_in(X, Y, Z))
U9(X, Y, Z, add_out(X, Y, Z)) → add_out(s(X), Y, s(Z))
U5(X, Y, D, add_out(s(X), Z, Y)) → U6(X, Y, D, gcd_in(s(X), Z, D))
gcd_in(X, Y, D) → U1(X, Y, D, le_in(X, Y))
le_in(0, 0) → le_out(0, 0)
le_in(0, s(Y)) → le_out(0, s(Y))
le_in(s(X), s(Y)) → U8(X, Y, le_in(X, Y))
U8(X, Y, le_out(X, Y)) → le_out(s(X), s(Y))
U1(X, Y, D, le_out(X, Y)) → U2(X, Y, D, gcd_le_in(X, Y, D))
gcd_le_in(0, Y, Y) → gcd_le_out(0, Y, Y)
U2(X, Y, D, gcd_le_out(X, Y, D)) → gcd_out(X, Y, D)
U6(X, Y, D, gcd_out(s(X), Z, D)) → gcd_le_out(s(X), Y, D)
U4(X, Y, D, gcd_le_out(Y, X, D)) → gcd_out(X, Y, D)

The argument filtering Pi contains the following mapping:
gcd_in(x1, x2, x3)  =  gcd_in(x1, x2)
U3(x1, x2, x3, x4)  =  U3(x1, x2, x4)
gt_in(x1, x2)  =  gt_in(x1, x2)
s(x1)  =  s(x1)
0  =  0
gt_out(x1, x2)  =  gt_out
U7(x1, x2, x3)  =  U7(x3)
U4(x1, x2, x3, x4)  =  U4(x4)
gcd_le_in(x1, x2, x3)  =  gcd_le_in(x1, x2)
U5(x1, x2, x3, x4)  =  U5(x1, x4)
add_in(x1, x2, x3)  =  add_in(x1, x3)
add_out(x1, x2, x3)  =  add_out(x2)
U9(x1, x2, x3, x4)  =  U9(x4)
U6(x1, x2, x3, x4)  =  U6(x4)
U1(x1, x2, x3, x4)  =  U1(x1, x2, x4)
le_in(x1, x2)  =  le_in(x1, x2)
le_out(x1, x2)  =  le_out
U8(x1, x2, x3)  =  U8(x3)
U2(x1, x2, x3, x4)  =  U2(x4)
gcd_le_out(x1, x2, x3)  =  gcd_le_out(x3)
gcd_out(x1, x2, x3)  =  gcd_out(x3)
ADD_IN(x1, x2, x3)  =  ADD_IN(x1, x3)
U71(x1, x2, x3)  =  U71(x3)
GCD_LE_IN(x1, x2, x3)  =  GCD_LE_IN(x1, x2)
U41(x1, x2, x3, x4)  =  U41(x4)
U81(x1, x2, x3)  =  U81(x3)
U21(x1, x2, x3, x4)  =  U21(x4)
LE_IN(x1, x2)  =  LE_IN(x1, x2)
U51(x1, x2, x3, x4)  =  U51(x1, x4)
U31(x1, x2, x3, x4)  =  U31(x1, x2, x4)
GCD_IN(x1, x2, x3)  =  GCD_IN(x1, x2)
U91(x1, x2, x3, x4)  =  U91(x4)
U61(x1, x2, x3, x4)  =  U61(x4)
GT_IN(x1, x2)  =  GT_IN(x1, x2)
U11(x1, x2, x3, x4)  =  U11(x1, x2, x4)

We have to consider all (P,R,Pi)-chains

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
PiDP
          ↳ DependencyGraphProof

Pi DP problem:
The TRS P consists of the following rules:

GCD_IN(X, Y, D) → U31(X, Y, D, gt_in(X, Y))
GCD_IN(X, Y, D) → GT_IN(X, Y)
GT_IN(s(X), s(Y)) → U71(X, Y, gt_in(X, Y))
GT_IN(s(X), s(Y)) → GT_IN(X, Y)
U31(X, Y, D, gt_out(X, Y)) → U41(X, Y, D, gcd_le_in(Y, X, D))
U31(X, Y, D, gt_out(X, Y)) → GCD_LE_IN(Y, X, D)
GCD_LE_IN(s(X), Y, D) → U51(X, Y, D, add_in(s(X), Z, Y))
GCD_LE_IN(s(X), Y, D) → ADD_IN(s(X), Z, Y)
ADD_IN(s(X), Y, s(Z)) → U91(X, Y, Z, add_in(X, Y, Z))
ADD_IN(s(X), Y, s(Z)) → ADD_IN(X, Y, Z)
U51(X, Y, D, add_out(s(X), Z, Y)) → U61(X, Y, D, gcd_in(s(X), Z, D))
U51(X, Y, D, add_out(s(X), Z, Y)) → GCD_IN(s(X), Z, D)
GCD_IN(X, Y, D) → U11(X, Y, D, le_in(X, Y))
GCD_IN(X, Y, D) → LE_IN(X, Y)
LE_IN(s(X), s(Y)) → U81(X, Y, le_in(X, Y))
LE_IN(s(X), s(Y)) → LE_IN(X, Y)
U11(X, Y, D, le_out(X, Y)) → U21(X, Y, D, gcd_le_in(X, Y, D))
U11(X, Y, D, le_out(X, Y)) → GCD_LE_IN(X, Y, D)

The TRS R consists of the following rules:

gcd_in(X, Y, D) → U3(X, Y, D, gt_in(X, Y))
gt_in(s(X), 0) → gt_out(s(X), 0)
gt_in(s(X), s(Y)) → U7(X, Y, gt_in(X, Y))
U7(X, Y, gt_out(X, Y)) → gt_out(s(X), s(Y))
U3(X, Y, D, gt_out(X, Y)) → U4(X, Y, D, gcd_le_in(Y, X, D))
gcd_le_in(s(X), Y, D) → U5(X, Y, D, add_in(s(X), Z, Y))
add_in(0, X, X) → add_out(0, X, X)
add_in(s(X), Y, s(Z)) → U9(X, Y, Z, add_in(X, Y, Z))
U9(X, Y, Z, add_out(X, Y, Z)) → add_out(s(X), Y, s(Z))
U5(X, Y, D, add_out(s(X), Z, Y)) → U6(X, Y, D, gcd_in(s(X), Z, D))
gcd_in(X, Y, D) → U1(X, Y, D, le_in(X, Y))
le_in(0, 0) → le_out(0, 0)
le_in(0, s(Y)) → le_out(0, s(Y))
le_in(s(X), s(Y)) → U8(X, Y, le_in(X, Y))
U8(X, Y, le_out(X, Y)) → le_out(s(X), s(Y))
U1(X, Y, D, le_out(X, Y)) → U2(X, Y, D, gcd_le_in(X, Y, D))
gcd_le_in(0, Y, Y) → gcd_le_out(0, Y, Y)
U2(X, Y, D, gcd_le_out(X, Y, D)) → gcd_out(X, Y, D)
U6(X, Y, D, gcd_out(s(X), Z, D)) → gcd_le_out(s(X), Y, D)
U4(X, Y, D, gcd_le_out(Y, X, D)) → gcd_out(X, Y, D)

The argument filtering Pi contains the following mapping:
gcd_in(x1, x2, x3)  =  gcd_in(x1, x2)
U3(x1, x2, x3, x4)  =  U3(x1, x2, x4)
gt_in(x1, x2)  =  gt_in(x1, x2)
s(x1)  =  s(x1)
0  =  0
gt_out(x1, x2)  =  gt_out
U7(x1, x2, x3)  =  U7(x3)
U4(x1, x2, x3, x4)  =  U4(x4)
gcd_le_in(x1, x2, x3)  =  gcd_le_in(x1, x2)
U5(x1, x2, x3, x4)  =  U5(x1, x4)
add_in(x1, x2, x3)  =  add_in(x1, x3)
add_out(x1, x2, x3)  =  add_out(x2)
U9(x1, x2, x3, x4)  =  U9(x4)
U6(x1, x2, x3, x4)  =  U6(x4)
U1(x1, x2, x3, x4)  =  U1(x1, x2, x4)
le_in(x1, x2)  =  le_in(x1, x2)
le_out(x1, x2)  =  le_out
U8(x1, x2, x3)  =  U8(x3)
U2(x1, x2, x3, x4)  =  U2(x4)
gcd_le_out(x1, x2, x3)  =  gcd_le_out(x3)
gcd_out(x1, x2, x3)  =  gcd_out(x3)
ADD_IN(x1, x2, x3)  =  ADD_IN(x1, x3)
U71(x1, x2, x3)  =  U71(x3)
GCD_LE_IN(x1, x2, x3)  =  GCD_LE_IN(x1, x2)
U41(x1, x2, x3, x4)  =  U41(x4)
U81(x1, x2, x3)  =  U81(x3)
U21(x1, x2, x3, x4)  =  U21(x4)
LE_IN(x1, x2)  =  LE_IN(x1, x2)
U51(x1, x2, x3, x4)  =  U51(x1, x4)
U31(x1, x2, x3, x4)  =  U31(x1, x2, x4)
GCD_IN(x1, x2, x3)  =  GCD_IN(x1, x2)
U91(x1, x2, x3, x4)  =  U91(x4)
U61(x1, x2, x3, x4)  =  U61(x4)
GT_IN(x1, x2)  =  GT_IN(x1, x2)
U11(x1, x2, x3, x4)  =  U11(x1, x2, x4)

We have to consider all (P,R,Pi)-chains
The approximation of the Dependency Graph [30] contains 4 SCCs with 9 less nodes.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
PiDP
                ↳ UsableRulesProof
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

LE_IN(s(X), s(Y)) → LE_IN(X, Y)

The TRS R consists of the following rules:

gcd_in(X, Y, D) → U3(X, Y, D, gt_in(X, Y))
gt_in(s(X), 0) → gt_out(s(X), 0)
gt_in(s(X), s(Y)) → U7(X, Y, gt_in(X, Y))
U7(X, Y, gt_out(X, Y)) → gt_out(s(X), s(Y))
U3(X, Y, D, gt_out(X, Y)) → U4(X, Y, D, gcd_le_in(Y, X, D))
gcd_le_in(s(X), Y, D) → U5(X, Y, D, add_in(s(X), Z, Y))
add_in(0, X, X) → add_out(0, X, X)
add_in(s(X), Y, s(Z)) → U9(X, Y, Z, add_in(X, Y, Z))
U9(X, Y, Z, add_out(X, Y, Z)) → add_out(s(X), Y, s(Z))
U5(X, Y, D, add_out(s(X), Z, Y)) → U6(X, Y, D, gcd_in(s(X), Z, D))
gcd_in(X, Y, D) → U1(X, Y, D, le_in(X, Y))
le_in(0, 0) → le_out(0, 0)
le_in(0, s(Y)) → le_out(0, s(Y))
le_in(s(X), s(Y)) → U8(X, Y, le_in(X, Y))
U8(X, Y, le_out(X, Y)) → le_out(s(X), s(Y))
U1(X, Y, D, le_out(X, Y)) → U2(X, Y, D, gcd_le_in(X, Y, D))
gcd_le_in(0, Y, Y) → gcd_le_out(0, Y, Y)
U2(X, Y, D, gcd_le_out(X, Y, D)) → gcd_out(X, Y, D)
U6(X, Y, D, gcd_out(s(X), Z, D)) → gcd_le_out(s(X), Y, D)
U4(X, Y, D, gcd_le_out(Y, X, D)) → gcd_out(X, Y, D)

The argument filtering Pi contains the following mapping:
gcd_in(x1, x2, x3)  =  gcd_in(x1, x2)
U3(x1, x2, x3, x4)  =  U3(x1, x2, x4)
gt_in(x1, x2)  =  gt_in(x1, x2)
s(x1)  =  s(x1)
0  =  0
gt_out(x1, x2)  =  gt_out
U7(x1, x2, x3)  =  U7(x3)
U4(x1, x2, x3, x4)  =  U4(x4)
gcd_le_in(x1, x2, x3)  =  gcd_le_in(x1, x2)
U5(x1, x2, x3, x4)  =  U5(x1, x4)
add_in(x1, x2, x3)  =  add_in(x1, x3)
add_out(x1, x2, x3)  =  add_out(x2)
U9(x1, x2, x3, x4)  =  U9(x4)
U6(x1, x2, x3, x4)  =  U6(x4)
U1(x1, x2, x3, x4)  =  U1(x1, x2, x4)
le_in(x1, x2)  =  le_in(x1, x2)
le_out(x1, x2)  =  le_out
U8(x1, x2, x3)  =  U8(x3)
U2(x1, x2, x3, x4)  =  U2(x4)
gcd_le_out(x1, x2, x3)  =  gcd_le_out(x3)
gcd_out(x1, x2, x3)  =  gcd_out(x3)
LE_IN(x1, x2)  =  LE_IN(x1, x2)

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

LE_IN(s(X), s(Y)) → LE_IN(X, Y)

R is empty.
Pi is empty.
We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ QDPSizeChangeProof
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP

Q DP problem:
The TRS P consists of the following rules:

LE_IN(s(X), s(Y)) → LE_IN(X, Y)

R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.
By using the subterm criterion [20] together with the size-change analysis [32] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs:



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
PiDP
                ↳ UsableRulesProof
              ↳ PiDP
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

ADD_IN(s(X), Y, s(Z)) → ADD_IN(X, Y, Z)

The TRS R consists of the following rules:

gcd_in(X, Y, D) → U3(X, Y, D, gt_in(X, Y))
gt_in(s(X), 0) → gt_out(s(X), 0)
gt_in(s(X), s(Y)) → U7(X, Y, gt_in(X, Y))
U7(X, Y, gt_out(X, Y)) → gt_out(s(X), s(Y))
U3(X, Y, D, gt_out(X, Y)) → U4(X, Y, D, gcd_le_in(Y, X, D))
gcd_le_in(s(X), Y, D) → U5(X, Y, D, add_in(s(X), Z, Y))
add_in(0, X, X) → add_out(0, X, X)
add_in(s(X), Y, s(Z)) → U9(X, Y, Z, add_in(X, Y, Z))
U9(X, Y, Z, add_out(X, Y, Z)) → add_out(s(X), Y, s(Z))
U5(X, Y, D, add_out(s(X), Z, Y)) → U6(X, Y, D, gcd_in(s(X), Z, D))
gcd_in(X, Y, D) → U1(X, Y, D, le_in(X, Y))
le_in(0, 0) → le_out(0, 0)
le_in(0, s(Y)) → le_out(0, s(Y))
le_in(s(X), s(Y)) → U8(X, Y, le_in(X, Y))
U8(X, Y, le_out(X, Y)) → le_out(s(X), s(Y))
U1(X, Y, D, le_out(X, Y)) → U2(X, Y, D, gcd_le_in(X, Y, D))
gcd_le_in(0, Y, Y) → gcd_le_out(0, Y, Y)
U2(X, Y, D, gcd_le_out(X, Y, D)) → gcd_out(X, Y, D)
U6(X, Y, D, gcd_out(s(X), Z, D)) → gcd_le_out(s(X), Y, D)
U4(X, Y, D, gcd_le_out(Y, X, D)) → gcd_out(X, Y, D)

The argument filtering Pi contains the following mapping:
gcd_in(x1, x2, x3)  =  gcd_in(x1, x2)
U3(x1, x2, x3, x4)  =  U3(x1, x2, x4)
gt_in(x1, x2)  =  gt_in(x1, x2)
s(x1)  =  s(x1)
0  =  0
gt_out(x1, x2)  =  gt_out
U7(x1, x2, x3)  =  U7(x3)
U4(x1, x2, x3, x4)  =  U4(x4)
gcd_le_in(x1, x2, x3)  =  gcd_le_in(x1, x2)
U5(x1, x2, x3, x4)  =  U5(x1, x4)
add_in(x1, x2, x3)  =  add_in(x1, x3)
add_out(x1, x2, x3)  =  add_out(x2)
U9(x1, x2, x3, x4)  =  U9(x4)
U6(x1, x2, x3, x4)  =  U6(x4)
U1(x1, x2, x3, x4)  =  U1(x1, x2, x4)
le_in(x1, x2)  =  le_in(x1, x2)
le_out(x1, x2)  =  le_out
U8(x1, x2, x3)  =  U8(x3)
U2(x1, x2, x3, x4)  =  U2(x4)
gcd_le_out(x1, x2, x3)  =  gcd_le_out(x3)
gcd_out(x1, x2, x3)  =  gcd_out(x3)
ADD_IN(x1, x2, x3)  =  ADD_IN(x1, x3)

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof
              ↳ PiDP
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

ADD_IN(s(X), Y, s(Z)) → ADD_IN(X, Y, Z)

R is empty.
The argument filtering Pi contains the following mapping:
s(x1)  =  s(x1)
ADD_IN(x1, x2, x3)  =  ADD_IN(x1, x3)

We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ QDPSizeChangeProof
              ↳ PiDP
              ↳ PiDP

Q DP problem:
The TRS P consists of the following rules:

ADD_IN(s(X), s(Z)) → ADD_IN(X, Z)

R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.
By using the subterm criterion [20] together with the size-change analysis [32] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs:



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
PiDP
                ↳ UsableRulesProof
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

GT_IN(s(X), s(Y)) → GT_IN(X, Y)

The TRS R consists of the following rules:

gcd_in(X, Y, D) → U3(X, Y, D, gt_in(X, Y))
gt_in(s(X), 0) → gt_out(s(X), 0)
gt_in(s(X), s(Y)) → U7(X, Y, gt_in(X, Y))
U7(X, Y, gt_out(X, Y)) → gt_out(s(X), s(Y))
U3(X, Y, D, gt_out(X, Y)) → U4(X, Y, D, gcd_le_in(Y, X, D))
gcd_le_in(s(X), Y, D) → U5(X, Y, D, add_in(s(X), Z, Y))
add_in(0, X, X) → add_out(0, X, X)
add_in(s(X), Y, s(Z)) → U9(X, Y, Z, add_in(X, Y, Z))
U9(X, Y, Z, add_out(X, Y, Z)) → add_out(s(X), Y, s(Z))
U5(X, Y, D, add_out(s(X), Z, Y)) → U6(X, Y, D, gcd_in(s(X), Z, D))
gcd_in(X, Y, D) → U1(X, Y, D, le_in(X, Y))
le_in(0, 0) → le_out(0, 0)
le_in(0, s(Y)) → le_out(0, s(Y))
le_in(s(X), s(Y)) → U8(X, Y, le_in(X, Y))
U8(X, Y, le_out(X, Y)) → le_out(s(X), s(Y))
U1(X, Y, D, le_out(X, Y)) → U2(X, Y, D, gcd_le_in(X, Y, D))
gcd_le_in(0, Y, Y) → gcd_le_out(0, Y, Y)
U2(X, Y, D, gcd_le_out(X, Y, D)) → gcd_out(X, Y, D)
U6(X, Y, D, gcd_out(s(X), Z, D)) → gcd_le_out(s(X), Y, D)
U4(X, Y, D, gcd_le_out(Y, X, D)) → gcd_out(X, Y, D)

The argument filtering Pi contains the following mapping:
gcd_in(x1, x2, x3)  =  gcd_in(x1, x2)
U3(x1, x2, x3, x4)  =  U3(x1, x2, x4)
gt_in(x1, x2)  =  gt_in(x1, x2)
s(x1)  =  s(x1)
0  =  0
gt_out(x1, x2)  =  gt_out
U7(x1, x2, x3)  =  U7(x3)
U4(x1, x2, x3, x4)  =  U4(x4)
gcd_le_in(x1, x2, x3)  =  gcd_le_in(x1, x2)
U5(x1, x2, x3, x4)  =  U5(x1, x4)
add_in(x1, x2, x3)  =  add_in(x1, x3)
add_out(x1, x2, x3)  =  add_out(x2)
U9(x1, x2, x3, x4)  =  U9(x4)
U6(x1, x2, x3, x4)  =  U6(x4)
U1(x1, x2, x3, x4)  =  U1(x1, x2, x4)
le_in(x1, x2)  =  le_in(x1, x2)
le_out(x1, x2)  =  le_out
U8(x1, x2, x3)  =  U8(x3)
U2(x1, x2, x3, x4)  =  U2(x4)
gcd_le_out(x1, x2, x3)  =  gcd_le_out(x3)
gcd_out(x1, x2, x3)  =  gcd_out(x3)
GT_IN(x1, x2)  =  GT_IN(x1, x2)

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

GT_IN(s(X), s(Y)) → GT_IN(X, Y)

R is empty.
Pi is empty.
We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ QDPSizeChangeProof
              ↳ PiDP

Q DP problem:
The TRS P consists of the following rules:

GT_IN(s(X), s(Y)) → GT_IN(X, Y)

R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.
By using the subterm criterion [20] together with the size-change analysis [32] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs:



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
PiDP
                ↳ UsableRulesProof

Pi DP problem:
The TRS P consists of the following rules:

GCD_IN(X, Y, D) → U31(X, Y, D, gt_in(X, Y))
GCD_IN(X, Y, D) → U11(X, Y, D, le_in(X, Y))
GCD_LE_IN(s(X), Y, D) → U51(X, Y, D, add_in(s(X), Z, Y))
U31(X, Y, D, gt_out(X, Y)) → GCD_LE_IN(Y, X, D)
U11(X, Y, D, le_out(X, Y)) → GCD_LE_IN(X, Y, D)
U51(X, Y, D, add_out(s(X), Z, Y)) → GCD_IN(s(X), Z, D)

The TRS R consists of the following rules:

gcd_in(X, Y, D) → U3(X, Y, D, gt_in(X, Y))
gt_in(s(X), 0) → gt_out(s(X), 0)
gt_in(s(X), s(Y)) → U7(X, Y, gt_in(X, Y))
U7(X, Y, gt_out(X, Y)) → gt_out(s(X), s(Y))
U3(X, Y, D, gt_out(X, Y)) → U4(X, Y, D, gcd_le_in(Y, X, D))
gcd_le_in(s(X), Y, D) → U5(X, Y, D, add_in(s(X), Z, Y))
add_in(0, X, X) → add_out(0, X, X)
add_in(s(X), Y, s(Z)) → U9(X, Y, Z, add_in(X, Y, Z))
U9(X, Y, Z, add_out(X, Y, Z)) → add_out(s(X), Y, s(Z))
U5(X, Y, D, add_out(s(X), Z, Y)) → U6(X, Y, D, gcd_in(s(X), Z, D))
gcd_in(X, Y, D) → U1(X, Y, D, le_in(X, Y))
le_in(0, 0) → le_out(0, 0)
le_in(0, s(Y)) → le_out(0, s(Y))
le_in(s(X), s(Y)) → U8(X, Y, le_in(X, Y))
U8(X, Y, le_out(X, Y)) → le_out(s(X), s(Y))
U1(X, Y, D, le_out(X, Y)) → U2(X, Y, D, gcd_le_in(X, Y, D))
gcd_le_in(0, Y, Y) → gcd_le_out(0, Y, Y)
U2(X, Y, D, gcd_le_out(X, Y, D)) → gcd_out(X, Y, D)
U6(X, Y, D, gcd_out(s(X), Z, D)) → gcd_le_out(s(X), Y, D)
U4(X, Y, D, gcd_le_out(Y, X, D)) → gcd_out(X, Y, D)

The argument filtering Pi contains the following mapping:
gcd_in(x1, x2, x3)  =  gcd_in(x1, x2)
U3(x1, x2, x3, x4)  =  U3(x1, x2, x4)
gt_in(x1, x2)  =  gt_in(x1, x2)
s(x1)  =  s(x1)
0  =  0
gt_out(x1, x2)  =  gt_out
U7(x1, x2, x3)  =  U7(x3)
U4(x1, x2, x3, x4)  =  U4(x4)
gcd_le_in(x1, x2, x3)  =  gcd_le_in(x1, x2)
U5(x1, x2, x3, x4)  =  U5(x1, x4)
add_in(x1, x2, x3)  =  add_in(x1, x3)
add_out(x1, x2, x3)  =  add_out(x2)
U9(x1, x2, x3, x4)  =  U9(x4)
U6(x1, x2, x3, x4)  =  U6(x4)
U1(x1, x2, x3, x4)  =  U1(x1, x2, x4)
le_in(x1, x2)  =  le_in(x1, x2)
le_out(x1, x2)  =  le_out
U8(x1, x2, x3)  =  U8(x3)
U2(x1, x2, x3, x4)  =  U2(x4)
gcd_le_out(x1, x2, x3)  =  gcd_le_out(x3)
gcd_out(x1, x2, x3)  =  gcd_out(x3)
GCD_LE_IN(x1, x2, x3)  =  GCD_LE_IN(x1, x2)
U51(x1, x2, x3, x4)  =  U51(x1, x4)
U31(x1, x2, x3, x4)  =  U31(x1, x2, x4)
GCD_IN(x1, x2, x3)  =  GCD_IN(x1, x2)
U11(x1, x2, x3, x4)  =  U11(x1, x2, x4)

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof

Pi DP problem:
The TRS P consists of the following rules:

GCD_IN(X, Y, D) → U31(X, Y, D, gt_in(X, Y))
GCD_IN(X, Y, D) → U11(X, Y, D, le_in(X, Y))
GCD_LE_IN(s(X), Y, D) → U51(X, Y, D, add_in(s(X), Z, Y))
U31(X, Y, D, gt_out(X, Y)) → GCD_LE_IN(Y, X, D)
U11(X, Y, D, le_out(X, Y)) → GCD_LE_IN(X, Y, D)
U51(X, Y, D, add_out(s(X), Z, Y)) → GCD_IN(s(X), Z, D)

The TRS R consists of the following rules:

gt_in(s(X), 0) → gt_out(s(X), 0)
gt_in(s(X), s(Y)) → U7(X, Y, gt_in(X, Y))
le_in(0, 0) → le_out(0, 0)
le_in(0, s(Y)) → le_out(0, s(Y))
le_in(s(X), s(Y)) → U8(X, Y, le_in(X, Y))
add_in(s(X), Y, s(Z)) → U9(X, Y, Z, add_in(X, Y, Z))
U7(X, Y, gt_out(X, Y)) → gt_out(s(X), s(Y))
U8(X, Y, le_out(X, Y)) → le_out(s(X), s(Y))
U9(X, Y, Z, add_out(X, Y, Z)) → add_out(s(X), Y, s(Z))
add_in(0, X, X) → add_out(0, X, X)

The argument filtering Pi contains the following mapping:
gt_in(x1, x2)  =  gt_in(x1, x2)
s(x1)  =  s(x1)
0  =  0
gt_out(x1, x2)  =  gt_out
U7(x1, x2, x3)  =  U7(x3)
add_in(x1, x2, x3)  =  add_in(x1, x3)
add_out(x1, x2, x3)  =  add_out(x2)
U9(x1, x2, x3, x4)  =  U9(x4)
le_in(x1, x2)  =  le_in(x1, x2)
le_out(x1, x2)  =  le_out
U8(x1, x2, x3)  =  U8(x3)
GCD_LE_IN(x1, x2, x3)  =  GCD_LE_IN(x1, x2)
U51(x1, x2, x3, x4)  =  U51(x1, x4)
U31(x1, x2, x3, x4)  =  U31(x1, x2, x4)
GCD_IN(x1, x2, x3)  =  GCD_IN(x1, x2)
U11(x1, x2, x3, x4)  =  U11(x1, x2, x4)

We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ QDPOrderProof

Q DP problem:
The TRS P consists of the following rules:

U31(X, Y, gt_out) → GCD_LE_IN(Y, X)
GCD_LE_IN(s(X), Y) → U51(X, add_in(s(X), Y))
GCD_IN(X, Y) → U31(X, Y, gt_in(X, Y))
U51(X, add_out(Z)) → GCD_IN(s(X), Z)
U11(X, Y, le_out) → GCD_LE_IN(X, Y)
GCD_IN(X, Y) → U11(X, Y, le_in(X, Y))

The TRS R consists of the following rules:

gt_in(s(X), 0) → gt_out
gt_in(s(X), s(Y)) → U7(gt_in(X, Y))
le_in(0, 0) → le_out
le_in(0, s(Y)) → le_out
le_in(s(X), s(Y)) → U8(le_in(X, Y))
add_in(s(X), s(Z)) → U9(add_in(X, Z))
U7(gt_out) → gt_out
U8(le_out) → le_out
U9(add_out(Y)) → add_out(Y)
add_in(0, X) → add_out(X)

The set Q consists of the following terms:

gt_in(x0, x1)
le_in(x0, x1)
add_in(x0, x1)
U7(x0)
U8(x0)
U9(x0)

We have to consider all (P,Q,R)-chains.
We use the reduction pair processor [15].


The following pairs can be oriented strictly and are deleted.


GCD_LE_IN(s(X), Y) → U51(X, add_in(s(X), Y))
The remaining pairs can at least be oriented weakly.

U31(X, Y, gt_out) → GCD_LE_IN(Y, X)
GCD_IN(X, Y) → U31(X, Y, gt_in(X, Y))
U51(X, add_out(Z)) → GCD_IN(s(X), Z)
U11(X, Y, le_out) → GCD_LE_IN(X, Y)
GCD_IN(X, Y) → U11(X, Y, le_in(X, Y))
Used ordering: Matrix interpretation [3]:
Non-tuple symbols:
M( U7(x1) ) =
/0\
\0/
+
/00\
\00/
·x1

M( add_in(x1, x2) ) =
/0\
\0/
+
/01\
\00/
·x1+
/10\
\10/
·x2

M( le_out ) =
/0\
\0/

M( U9(x1) ) =
/1\
\0/
+
/01\
\01/
·x1

M( U8(x1) ) =
/0\
\0/
+
/00\
\00/
·x1

M( add_out(x1) ) =
/1\
\0/
+
/10\
\10/
·x1

M( 0 ) =
/0\
\1/

M( s(x1) ) =
/1\
\0/
+
/10\
\00/
·x1

M( le_in(x1, x2) ) =
/0\
\0/
+
/00\
\00/
·x1+
/00\
\00/
·x2

M( gt_out ) =
/0\
\0/

M( gt_in(x1, x2) ) =
/0\
\0/
+
/00\
\00/
·x1+
/00\
\00/
·x2

Tuple symbols:
M( GCD_LE_IN(x1, x2) ) = 0+
[1,0]
·x1+
[1,0]
·x2

M( U11(x1, ..., x3) ) = 0+
[1,0]
·x1+
[1,0]
·x2+
[0,0]
·x3

M( U31(x1, ..., x3) ) = 0+
[1,0]
·x1+
[1,0]
·x2+
[0,0]
·x3

M( GCD_IN(x1, x2) ) = 0+
[1,0]
·x1+
[1,0]
·x2

M( U51(x1, x2) ) = 0+
[1,0]
·x1+
[1,0]
·x2


Matrix type:
We used a basic matrix type which is not further parametrizeable.


As matrix orders are CE-compatible, we used usable rules w.r.t. argument filtering in the order.
The following usable rules [17] were oriented:

U9(add_out(Y)) → add_out(Y)
add_in(s(X), s(Z)) → U9(add_in(X, Z))
add_in(0, X) → add_out(X)



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
                      ↳ QDP
                        ↳ QDPOrderProof
QDP
                            ↳ DependencyGraphProof

Q DP problem:
The TRS P consists of the following rules:

U31(X, Y, gt_out) → GCD_LE_IN(Y, X)
GCD_IN(X, Y) → U31(X, Y, gt_in(X, Y))
U51(X, add_out(Z)) → GCD_IN(s(X), Z)
U11(X, Y, le_out) → GCD_LE_IN(X, Y)
GCD_IN(X, Y) → U11(X, Y, le_in(X, Y))

The TRS R consists of the following rules:

gt_in(s(X), 0) → gt_out
gt_in(s(X), s(Y)) → U7(gt_in(X, Y))
le_in(0, 0) → le_out
le_in(0, s(Y)) → le_out
le_in(s(X), s(Y)) → U8(le_in(X, Y))
add_in(s(X), s(Z)) → U9(add_in(X, Z))
U7(gt_out) → gt_out
U8(le_out) → le_out
U9(add_out(Y)) → add_out(Y)
add_in(0, X) → add_out(X)

The set Q consists of the following terms:

gt_in(x0, x1)
le_in(x0, x1)
add_in(x0, x1)
U7(x0)
U8(x0)
U9(x0)

We have to consider all (P,Q,R)-chains.
The approximation of the Dependency Graph [15,17,22] contains 0 SCCs with 5 less nodes.